<?php
  include("../Includes/FusionCharts_Gen.php");
  include("../Includes/DBConn.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
	<HEAD>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>UPLB DV</title>
		
		<script language="Javascript" src="../js/FusionCharts.js"></script>
		<script type="text/javascript" src="../fancybox/jquery.min.js"></script>
		<script type="text/javascript" src="../fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
		<script type="text/javascript" src="../fancybox/jquery.fancybox-1.3.4.pack.js"></script>
		
		<script type="text/javascript">

		$(document).ready(function() {
			$("a#example1").fancybox();

			$("a#example2").fancybox({
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$("a#example3").fancybox({
				'transitionIn'	: 'none',
				'transitionOut'	: 'none'	
			});

			$("a#example4").fancybox({
				'opacity'		: true,
				'overlayShow'	: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'none'
			});

			$("a#example5").fancybox();

			$("a#example6").fancybox({
				'titlePosition'		: 'outside',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9
			});

			$("a#example7").fancybox({
				'titlePosition'	: 'inside'
			});

			$("a#example8").fancybox({
				'titlePosition'	: 'over'
			});

			$("a[rel=example_group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});

			$("#various1").fancybox({
					'titlePosition'		: 'inside',
					'transitionIn'		: 'none',
					'transitionOut'		: 'none'
			});

			$("#various2").fancybox();

			$("a.various3").fancybox({
					'width'				: '90%',
					'height'			: '100%',
					'autoScale'			: false,
					'transitionIn'		: 'elastic',
					'transitionOut'		: 'elastic',
					'type'				: 'iframe'
			});

			$("#various4").fancybox({
					'padding'			: 0,
					'autoScale'			: false,
					'transitionIn'		: 'none',
					'transitionOut'		: 'none'
			});

		});

	</script>

		<link rel="stylesheet" href="../fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />

	</HEAD>

	<BODY>
	<CENTER>
			<?php
				$subject = $_GET['subject'];
				if($subject=="default"){
					$courseCode = "CMSC 11";
					$startAY = 1996;
					$endAY = 2007;
				}
				else{
					$courseCode = $_POST['courseCode'];
					$startAY = $_POST['startAY'];
					$endAY = $_POST['endAY'];
				}
				
				$yAxis = "passingRate";
				
				$FC = new FusionCharts("Line","850","430");
				$FC->setSwfPath("../FusionCharts/");
				$strParam="caption=$courseCode Passing Rates;subcaption=(in percent);xAxisName=Academic Year;yAxisName=Passing Rates; yaxismaxvalue=100;formatNumberScale=0;decimalPrecision=0";
				$FC->setChartParams($strParam);
				$link = connectToDB();
				$strQuery = "select "."$yAxis".", academicYear from course where courseCode='$courseCode' and academicYear>="."$startAY"." and academicYear<="."$endAY";
				
				if($courseCode!=""){
					$result = mysql_query($strQuery) or die(mysql_error());
				}
				
				if ($result) 
				{
					$FC->addDataFromDatabase($result, $yAxis, "academicYear");
				}

				mysql_close($link);
				$FC->renderChart();
			?>
	</CENTER>
	</BODY>
</HTML>